<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 15;
	$params=array('uniacid'=>$_SESSION['uniacid']);
	
    $orderby='createtime desc';
	$total='';
	$return['list']=pdo_getslice('jy_cxjxiche_suggest',$params,array($pindex,$psize),$total,$fields,'',$orderby);	
	foreach($return['list'] as &$v){
		$member=pdo_get('jy_cxjxiche_member',array('mid'=>$v['mid']));
		
		$v['createtime']=date('Y-m-d H:i:s',$v['createtime']);
		$v['name']=$member['name'];
		$v['mobile']=$member['mobile'];
	}
	$htmls=array(
		'type'=>'list',
		'tabs'=>array(
			array('op'=>'list','title'=>'投诉建议'),
		),
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			
			array('name'=>'name','title'=>'投诉人','type'=>'string'),
			array('name'=>'mobile','title'=>'电话','type'=>'string'),
			
			array('name'=>'createtime','title'=>'投诉时间','type'=>'string'),
			array('name'=>'message','title'=>'内容','type'=>'string'),
						
		),
		'action'=>array(	
			array('type'=>'href','op'=>'detail','title'=>'详细'),
			
		),),
		
	
	);
	
	
	$return['htmls']=$htmls;
	
	exi($return);
	}
	
if($_RQ['op']=='del'){

	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_cxjxiche_suggest',array('id'=>$id));	
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_cxjxiche_suggest',array('id'=>$id));	
			}
		}
	}
	exi('删除成功！');

}
if($_RQ['op']=='detail'){

	$id=intval($_RQ['id']);
	
	$return['item']=pdo_get('jy_cxjxiche_suggest',array('id'=>$id));
	$return['item']['createtime']=date('Y-m-d H:i:s',$return['item']['createtime']);
	///print_r($return['item']);exit();
	$htmls=array(
		'type'=>'edit',
		'post'=>'post',
		'desc'=>'订单详情',		
		'edit'=>array(
			array('name'=>'createtime','title'=>'投诉时间','type'=>'string','read'=>true),
			array('name'=>'message','title'=>'内容','type'=>'text','read'=>true),	
			
			
		)
		);
	$return['htmls']=$htmls;
	
	exi($return);
}
?>